Package eBLBaseComponents.apis.ebay

Source Code of eBLBaseComponents.apis.ebay.AbstractResponseType

/**
* AbstractResponseType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
*/

package eBLBaseComponents.apis.ebay;

import java.text.ParseException;
import java.util.ArrayList;

import org.apache.axis.types.Token;
import org.apache.commons.lang.StringUtils;
import org.javacommerce.paypal.ws.API;
import org.javacommerce.paypal.ws.NVPConstants;


/**
* Base type definition of a response payload that can carry any
*                     type of payload content with following optional
* elements:
*                       - timestamp of response message,
*                       - application level acknowledgement, and
*                       - application-level errors and warnings.
*/
public abstract class AbstractResponseType  implements NVPConstants, java.io.Serializable {

    protected final void addSeverityCode(String _name, String _value) {
      int errorNum = Integer.parseInt(StringUtils.replace(_name, FIELD_L_SEVERITYCODE, ""));
      if (getErrors() == null || getErrors().length <= errorNum) {
        addErrors(errorNum);
      }
      getErrors(errorNum).setSeverityCode(SeverityCodeType.fromString(_value));     
    }
   
    protected final void addLongMessage(String _name, String _value) {
      int errorNum = Integer.parseInt(StringUtils.replace(_name, FIELD_L_LONGMESSAGE, ""));
      if (getErrors() == null || getErrors().length <= errorNum) {
        addErrors(errorNum);
      }
      getErrors(errorNum).setLongMessage(_value);     
    }
   
    protected final void addShortMessage(String _name, String _value) {
      int errorNum = Integer.parseInt(StringUtils.replace(_name, FIELD_L_SHORTMESSAGE, ""));
      if (getErrors() == null || getErrors().length <= errorNum) {
        addErrors(errorNum);
      }
      getErrors(errorNum).setShortMessage(_value);
    }
   
    protected final void addErrorCode(String _name, String _value) {
      int errorNum = Integer.parseInt(StringUtils.replace(_name, FIELD_L_ERRORCODE, ""));
      if (getErrors() == null || getErrors().length <= errorNum) {
        addErrors(errorNum);
      }
      getErrors(errorNum).setErrorCode(new Token(_value));
    }
   
    protected final void addErrors(int _num) {
      ArrayList<ErrorType> lines = new ArrayList<ErrorType>();
      if (getErrors() != null) {
        for (int i = 0; i < getErrors().length; i++) {
          lines.add(i, getErrors(i));
        }
      }
      for (int i = 0; i < _num+1; i++) {
        lines.add(i, new ErrorType());
      }
      setErrors(((ErrorType[]) lines.toArray(new ErrorType[lines.size()])));
    }

    protected final boolean isCommonField(String _name) {
      if (_name.equals(FIELD_ACK) || _name.equals(FIELD_TIMESTAMP) || _name.equals(FIELD_CORRELATIONID)
          || _name.equals(FIELD_VERSION) || _name.equals(FIELD_BUILD) || _name.startsWith(FIELD_L_ERRORCODE)
          || _name.startsWith(FIELD_L_SHORTMESSAGE) || _name.startsWith(FIELD_L_LONGMESSAGE)
          || _name.startsWith(FIELD_L_SEVERITYCODE)) {
        return true;
      }
      return false;
    }
   
    protected final void processCommonField(String _name, String _value) throws ParseException {
    if (_name.equals(FIELD_ACK) && _value != null) {
      setAck(AckCodeType.fromString(_value));
    }
    else if (_name.equals(FIELD_TIMESTAMP) && _value != null) {
      setTimestamp(API.apiStringToCalendar(_value));
    }
    else if (_name.equals(FIELD_CORRELATIONID) && _value != null) {
      setCorrelationID(_value);
    }
    else if (_name.equals(FIELD_VERSION) && _value != null) {
      setVersion(_value);
    }
    else if (_name.equals(FIELD_BUILD) && _value != null) {
      setBuild(_value);
    }
    // Process Errors
    else if (_name.startsWith(FIELD_L_ERRORCODE) && _value != null) {
      addErrorCode(_name, _value);
    }
    else if (_name.startsWith(FIELD_L_SHORTMESSAGE) && _value != null) {
      addShortMessage(_name, _value);
    }
    else if (_name.startsWith(FIELD_L_LONGMESSAGE) && _value != null) {
      addLongMessage(_name, _value);
    }
    else if (_name.startsWith(FIELD_L_SEVERITYCODE) && _value != null) {
      addSeverityCode(_name, _value);
    }

    }
 
  /** This value represents the date and time (GMT) when the response
*
*                   was generated by a service provider (as a result of
* processing
*                   of a request). */
    private java.util.Calendar timestamp;
    /** Application level acknowledgement code. */
    private eBLBaseComponents.apis.ebay.AckCodeType ack;
    /** CorrelationID may be used optionally with an application
*                                    level acknowledgement. */
    private java.lang.String correlationID;
    private eBLBaseComponents.apis.ebay.ErrorType[] errors;
    /** This refers to the version of the response payload schema. */
    private java.lang.String version;
    /** This refers to the specific software build that was used in the
* deployment
*                                for processing the request and generating
* the response. */
    private java.lang.String build;

    public AbstractResponseType() {
    }

    public AbstractResponseType(
           java.util.Calendar timestamp,
           eBLBaseComponents.apis.ebay.AckCodeType ack,
           java.lang.String correlationID,
           eBLBaseComponents.apis.ebay.ErrorType[] errors,
           java.lang.String version,
           java.lang.String build) {
           this.timestamp = timestamp;
           this.ack = ack;
           this.correlationID = correlationID;
           this.errors = errors;
           this.version = version;
           this.build = build;
    }


    /**
     * Gets the timestamp value for this AbstractResponseType.
     *
     * @return timestamp This value represents the date and time (GMT) when the response
*
*                   was generated by a service provider (as a result of
* processing
*                   of a request).
     */
    public java.util.Calendar getTimestamp() {
        return timestamp;
    }


    /**
     * Sets the timestamp value for this AbstractResponseType.
     *
     * @param timestamp This value represents the date and time (GMT) when the response
*
*                   was generated by a service provider (as a result of
* processing
*                   of a request).
     */
    public void setTimestamp(java.util.Calendar timestamp) {
        this.timestamp = timestamp;
    }


    /**
     * Gets the ack value for this AbstractResponseType.
     *
     * @return ack Application level acknowledgement code.
     */
    public eBLBaseComponents.apis.ebay.AckCodeType getAck() {
        return ack;
    }


    /**
     * Sets the ack value for this AbstractResponseType.
     *
     * @param ack Application level acknowledgement code.
     */
    public void setAck(eBLBaseComponents.apis.ebay.AckCodeType ack) {
        this.ack = ack;
    }


    /**
     * Gets the correlationID value for this AbstractResponseType.
     *
     * @return correlationID CorrelationID may be used optionally with an application
*                                    level acknowledgement.
     */
    public java.lang.String getCorrelationID() {
        return correlationID;
    }


    /**
     * Sets the correlationID value for this AbstractResponseType.
     *
     * @param correlationID CorrelationID may be used optionally with an application
*                                    level acknowledgement.
     */
    public void setCorrelationID(java.lang.String correlationID) {
        this.correlationID = correlationID;
    }


    /**
     * Gets the errors value for this AbstractResponseType.
     *
     * @return errors
     */
    public eBLBaseComponents.apis.ebay.ErrorType[] getErrors() {
        return errors;
    }


    /**
     * Sets the errors value for this AbstractResponseType.
     *
     * @param errors
     */
    public void setErrors(eBLBaseComponents.apis.ebay.ErrorType[] errors) {
        this.errors = errors;
    }

    public eBLBaseComponents.apis.ebay.ErrorType getErrors(int i) {
        return this.errors[i];
    }

    public void setErrors(int i, eBLBaseComponents.apis.ebay.ErrorType _value) {
        this.errors[i] = _value;
    }


    /**
     * Gets the version value for this AbstractResponseType.
     *
     * @return version This refers to the version of the response payload schema.
     */
    public java.lang.String getVersion() {
        return version;
    }


    /**
     * Sets the version value for this AbstractResponseType.
     *
     * @param version This refers to the version of the response payload schema.
     */
    public void setVersion(java.lang.String version) {
        this.version = version;
    }


    /**
     * Gets the build value for this AbstractResponseType.
     *
     * @return build This refers to the specific software build that was used in the
* deployment
*                                for processing the request and generating
* the response.
     */
    public java.lang.String getBuild() {
        return build;
    }


    /**
     * Sets the build value for this AbstractResponseType.
     *
     * @param build This refers to the specific software build that was used in the
* deployment
*                                for processing the request and generating
* the response.
     */
    public void setBuild(java.lang.String build) {
        this.build = build;
    }


    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof AbstractResponseType)) return false;
        AbstractResponseType other = (AbstractResponseType) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true &&
            ((this.timestamp==null && other.getTimestamp()==null) ||
             (this.timestamp!=null &&
              this.timestamp.equals(other.getTimestamp()))) &&
            ((this.ack==null && other.getAck()==null) ||
             (this.ack!=null &&
              this.ack.equals(other.getAck()))) &&
            ((this.correlationID==null && other.getCorrelationID()==null) ||
             (this.correlationID!=null &&
              this.correlationID.equals(other.getCorrelationID()))) &&
            ((this.errors==null && other.getErrors()==null) ||
             (this.errors!=null &&
              java.util.Arrays.equals(this.errors, other.getErrors()))) &&
            ((this.version==null && other.getVersion()==null) ||
             (this.version!=null &&
              this.version.equals(other.getVersion()))) &&
            ((this.build==null && other.getBuild()==null) ||
             (this.build!=null &&
              this.build.equals(other.getBuild())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getTimestamp() != null) {
            _hashCode += getTimestamp().hashCode();
        }
        if (getAck() != null) {
            _hashCode += getAck().hashCode();
        }
        if (getCorrelationID() != null) {
            _hashCode += getCorrelationID().hashCode();
        }
        if (getErrors() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getErrors());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getErrors(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        if (getVersion() != null) {
            _hashCode += getVersion().hashCode();
        }
        if (getBuild() != null) {
            _hashCode += getBuild().hashCode();
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

}
TOP

Related Classes of eBLBaseComponents.apis.ebay.AbstractResponseType

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.